(function(joint, paper) {

    window.addEventListener('resize', joint.util.debounce(rescale), false);
    rescale();

    function rescale() {
        joint.ui.ContextToolbar.close();
        paper.scaleContentToFit({ padding: 50 });
    }

})(joint, window.paper);
